package com.dms.modules.user.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@ApiModel(value = "AddressDTO", description = "收货地址DTO")
public class AddressDTO {

    @ApiModelProperty("地址ID")
    private Long id;

    @NotBlank(message = "收货人不能为空")
    @ApiModelProperty(value = "收货人", required = true)
    private String receiverName;

    @NotBlank(message = "联系电话不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    @ApiModelProperty(value = "联系电话", required = true)
    private String receiverPhone;

    @NotBlank(message = "省份编码不能为空")
    @ApiModelProperty(value = "省份编码", required = true)
    private String provinceCode;

    @NotBlank(message = "省份不能为空")
    @ApiModelProperty(value = "省份", required = true)
    private String province;

    @NotBlank(message = "城市编码不能为空")
    @ApiModelProperty(value = "城市编码", required = true)
    private String cityCode;

    @NotBlank(message = "城市不能为空")
    @ApiModelProperty(value = "城市", required = true)
    private String city;

    @NotBlank(message = "区县编码不能为空")
    @ApiModelProperty(value = "区县编码", required = true)
    private String districtCode;

    @NotBlank(message = "区/县不能为空")
    @ApiModelProperty(value = "区/县", required = true)
    private String district;

    @NotBlank(message = "详细地址不能为空")
    @ApiModelProperty(value = "详细地址", required = true)
    private String detailAddress;

    @ApiModelProperty(value = "邮政编码")
    private String postCode;

    @NotNull(message = "是否默认地址不能为空")
    @Min(value = 0, message = "是否默认地址值不正确")
    @Max(value = 1, message = "是否默认地址值不正确")
    @ApiModelProperty("是否设为默认地址：0-否 1-是")
    private Integer isDefault;

    @ApiModelProperty("地址标签（如：家、公司等）")
    private String label;
}